Skip to content

fix: add filename parameters to inline Content-Disposition headers #9638

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 18, 2025

Conversation

michalsn
Copy link
Member

Description
This PR fixes a bug in DownloadResponse::inline() method where filename parameters were missing for content disposition. This caused browsers to fall back to using the last URL segment as the filename instead of the intended filename.

The browser will display the filename that was set for image and PDF files.

I added addslashes() because if the filename contains a quote character ("), it would break the header syntax by prematurely terminating the quoted string.

The problem was recognized here: https://forum.codeigniter.com/showthread.php?tid=93147

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@michalsn michalsn added the bug Verified issues on the current code behavior or pull requests that will fix them label Jul 16, 2025
@samsonasik samsonasik merged commit 90edae6 into codeigniter4:develop Jul 18, 2025
50 checks passed
@samsonasik
Copy link
Member

Thank you @michalsn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants